﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Windows.Data;

namespace bdnt_pets_system.Tools
{
    public class ExtendedDataGridTextColumn : DataGridTextColumn
    {
        public static readonly DependencyProperty VisibilityProperty = DependencyProperty.Register("Visibility", typeof(Visibility), typeof(DataGridTextColumn), new PropertyMetadata(Visibility.Collapsed, VisibilityChanged));
        public new Visibility Visibility
        {
            get { return (Visibility)GetValue(VisibilityProperty); }
            set
            {
                VisibilityChanged(this, new DependencyPropertyChangedEventArgs());
                SetValue(VisibilityProperty, value);
            }
        }
        private static void VisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if ((DataGridTextColumn)d != null)
            {
                ((DataGridTextColumn)d).Visibility = (Visibility)e.NewValue;
            }
        }

        public BindingExpressionBase SetBinding(DependencyProperty dp, BindingBase binding)
        {
            return BindingOperations.SetBinding(this, dp, binding);
        }
    }
}
